package com.freewater.springboot.demo.dataaccess.oxm.xstream;

import com.freewater.springboot.demo.PackageUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.io.IOException;

public class Main {
    public static void main(String[] args) throws IOException {
        final String xmlPath = PackageUtils.getDefaultAppContextXmlPath(Main.class);
        ApplicationContext appContext =
                new ClassPathXmlApplicationContext(xmlPath);
        Application application = (Application) appContext.getBean("application");
        System.out.println(application.getSettings().isFooEnabled());
        application.saveSettings();
        application.loadSettings();
        System.out.println(application.getSettings().isFooEnabled());
        //
        application.getSettings().setFooEnabled(true);
        System.out.println(application.getSettings().isFooEnabled());
        application.saveSettings();
        application.loadSettings();
        System.out.println(application.getSettings().isFooEnabled());
    }
}
